package com.spring.mvc.service;

import com.spring.mvc.dao.SchoolDao;
import com.spring.mvc.entity.School;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLException;

/**
 * ${DESCRIPTION}
 *
 * @author roger
 * @email 190642964@qq.com
 * @create 2018-02-01 12:31
 **/
@Service
public class SchoolService {

    @Autowired
    private SchoolDao schoolDao;

    /**
     * 根据ID查询
     *
     * @param id 主键
     */
    public School findSchool(int id) throws SQLException {
        return schoolDao.selectById(id);
    }

    /**
     * 保存 Person
     *
     * @param name 名字
     */
    public void saveSchool(String name) throws SQLException {
        schoolDao.insertSchool(name);
    }

}
